package com.citywithincity.utils.dataconvert;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import com.citywithincity.api.ApiBuildConfig;
import com.citywithincity.db.interfaces.IValueConvert;

public class String2Date implements IValueConvert {

	@Override
	public Object convert(Object value) {
		if(value==null)return null;
		try {
			return new SimpleDateFormat(ApiBuildConfig.DATE_FORMAT).parse((String)value).getTime()/1000;
		} catch (ParseException e) {
			throw new RuntimeException(e);
		}
	}

}
